An instruction to be executed by a processor may be associated with a number of different operations. For example, execution of an instruction might involve: fetching the instruction; decoding the instruction; performing an Arithmetic-Logic Unit (ALU) operation; and accessing data/memory. The processor could perform all of these operations for one instruction before beginning any of the operations for the next instruction. This approach, however, may limit the rate at which the processor executes instructions.
It is known that processor performance may be improved when instructions are executed via a processor “pipeline.” FIG. 1 is a block diagram of a processor pipeline 100 including a fetch stage 110 that retrieves an instruction from memory and increments a program counter. A decode stage 120 may translate that instruction and retrieve information from a register file. The pipeline 100 may also include an ALU stage 130 that performs arithmetic and logic operations on operands (e.g., information that was retrieved from the register file during the decode stage 120). A data/memory stage 140 may read and/or write information as appropriate. Some instructions may further have a second data/memory stage 150. For example, an instruction that reads from memory or that accesses a coprocessor might have a second data/memory stage 150.
Note that each stage in the pipeline 100 may simultaneously perform operations associated with different instructions. For example, the fetch stage 110 may retrieve a first instruction from memory during a first clock cycle. When that operation is complete, the decode stage 120 can decode the first instruction and retrieve information from a register file during a second clock cycle. While the decode stage 120 is performing these operations for the first instruction, the fetch stage 110 can retrieve the next instruction from memory. Because the pipeline 100 may perform operations associated with a number of different instructions at the same time, the rate at which the instructions are executed may be increased.